package main

import (
	"fmt"
	"os/exec"
)

func main() {
	var
	(
		cmd *exec.Cmd
		output []byte
		err error
	)
	cmd = exec.Command("/bin/bash","-c","ls -l")

	// 运行子进程，捕获错误信息(pip)
	//err = cmd.Run()
	//fmt.Println(err)

	// 运行子进程，捕获输出(pip)
	if output,err = cmd.CombinedOutput();err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(output))

}
